X1 = [0.697,0.774,0.634,0.608,0.556,0.403,0.481,0.437,0.666,0.243,0.245,0.343,0.639,0.657,0.360,0.593,0.719]
X2 = [0.460,0.376,0.264,0.318,0.215,0.237,0.149,0.211,0.091,0.267,0.057,0.099,0.161,0.198,0.370,0.042,0.103]
Y = [1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0]
from sklearn.linear_model import LogisticRegression
import numpy as np
from sklearn.metrics import confusion_matrix,classification_report
import matplotlib.pyplot as plt
# 16　写出库函数模型 最大迭代次数为5000 ，学习率自定  5分
model=LogisticRegression(max_iter=5000,solver='liblinear')
# 17　在训练集上进行训练   5分
x=np.c_[X1,X2]
y=np.array(Y)

np.random.seed(66)
a=np.random.permutation(len(x))
x=x[a]
y=y[a]
num=int(0.7*len(x))
train_x,test_x=np.split(x,[num])
train_y,test_y=np.split(y,[num])

model.fit(train_x,train_y)

# 18　在测试集上预测 并输出预测值 5分
h=model.predict(x)
# 19　输出测试集准确率  5分
print(model.score(x,y))
# 20　输出混淆矩阵和分类报告，全输出得满分，少一项得此问得0分   5分
print(confusion_matrix(y,h))
print(classification_report(y,h))